package com.yykj.hospital.server.model.repository;

import com.yykj.hospital.server.model.entity.HospitalDepartment;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Set;

/**
 * Created by chendg on 2021/9/9 0009.
 */
@Repository
public interface HospitalDepartmentRepository extends JpaRepository<HospitalDepartment, Integer>, JpaSpecificationExecutor<HospitalDepartment> {

	List<HospitalDepartment> findAllByHospitalId(Integer hospitalId);

	List<HospitalDepartment> findAllByHospitalIdAndIdIn(Integer hospitalId, Set<Integer> ids);

	List<HospitalDepartment> findAllByHospitalIdAndHotOrderBySorting(Integer hospitalId,Boolean hot);

//	List<HospitalDepartment> findByHospitalIdAndHotAndStatusOrderBySorting(Pageable pageable, Integer hospitalId, Boolean hot,Boolean status);
//
//	List<HospitalDepartment> findAllByHospitalIdAndHotAndStatusOrderBySorting(Integer hospitalId,Boolean hot,Boolean status);

	List<HospitalDepartment> findFirst12ByHospitalIdAndHotOrderBySorting(Integer hospitalId,Boolean hot);


	HospitalDepartment findFirstByHospitalIdAndPidAndName(Integer hospitalId,Integer pid, String name);

}
